﻿Ext.define('GS.view.event.View', {
    extend: 'Ext.form.FormPanel',
    xtype: 'viewevent',
    id: 'viewevent',

    updateEvent: function (eventData) {
        Ext.getCmp('titleViewEvent').setTitle(eventData.title);
        Ext.getCmp('dateViewEvent').setHtml("Dato/Tid: " + eventData.date);
        Ext.getCmp('locationViewEvent').setHtml("Sted: " + eventData.location);
        Ext.getCmp('descriptionViewEvent').setHtml(eventData.description);
        Ext.getCmp('viewpost').config.event_id = eventData.id;
        //Ext.getCmp('commentlist').getStore().load();
    },

    getEventId: function () {
        return Ext.getCmp('viewevent').config.post_id;
    },

    config: {

        event_id: -1,

        layout: {
            type: 'vbox'
        },
        scrollable: true,

        items: [
        {
            xtype: 'titlebar',
            tpl: '{title}',
            id: 'titleViewEvent',
            docked: 'top',
            items:
            {
                xtype: 'button',
                text: 'Tilbage',
                ui: 'back',
                id: 'btnBackViewEvent'
            }
        },
        {
            xtype: 'label',
            id: 'dateViewEvent',
            margin: 10
        },
        {
            xtype: 'label',
            id: 'locationViewEvent',
            margin: 10
        },
        {
            xtype: 'label',
            id: 'descriptionViewEvent',
            margin: 10
        }]
    }
});